<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use frontend\assets\AppAsset;

$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;

$fieldOptions1 = [
    'options' => ['class' => 'phoneNumber'],
    'inputTemplate' => "{input}<i class=\"fa fa-mobile-phone\"></i>"
];

$fieldOptions2 = [
    'options' => ['class' => 'phoneNumber'],
    'inputTemplate' => "{input}<i class=\"fa fa-lock passworIcon\"></i>"
];

$fieldOptions3 = [
    'inputTemplate' => "{input}<a href=\"/site/findpassword\" class=\"right forgetPassword\">找回密码</a>"
];

?>
    <div class="login">
      <div class="main">
        <div class="content-wrap">
          <div class="logo_newBg left">
          <?php foreach ($banner as $key => $value): ?>
            <img  src="<?=$value['img_url']?>" value="<?=$value['id']?>" link="<?=$value['link']?>" title="<?= $value['name']?>" style="width:<?= $value['width']?>px;height:<?= $value['height']?>px;"/>
          <?php endforeach ?>
          </div>
          <div class="right inputArea">
            <h1 class="tt">添品网会员<a href="/site/register" class="right">立即注册></a></h1>

            <?php $form = ActiveForm::begin(['method'=>'post','options' => ['class' => 'positionr']]);?>

              <!-- //用于阻止 from表单自动填充的占位符 -->
                <input  type="text"  style="display:none;"/>
                <input  type="password" style="display:none;"/>
                <!-- //用于阻止 from表单自动填充的占位符 -->
                
              <?= $form
                  ->field($model, 'phone',$fieldOptions1)
                  ->label(false)->error(false)
                  ->textInput(['maxlength' => 11,'placeholder'=>'手机号码','class'=>'inputTxt','onkeyup'=>"this.value=this.value.replace(/\D/g,'')"]) ?>

              <?= $form
                  ->field($model, 'password', $fieldOptions2)
                  ->label(false)->error(false)
                  ->passwordInput(['placeholder' => $model->getAttributeLabel('password'),'class'=>'inputPwd']) ?>

              <?= $form->field($model, 'rememberMe',$fieldOptions3)->label("自动登录")->checkbox() ?>

              <p class="errorInfo">
                <img src="http://static.tianpinwang.com.cn/v1/images/login/error-icon.png" alt="" class="errorIcon">
                <span class="errorTxt"></span>
              </p>
              <?php if ($error == 1): ?>
                <p class="errorInfo1" style="display:block;">
                  <img src="http://static.tianpinwang.com.cn/v1/images/login/error-icon.png" alt="" class="errorIcon">手机号码和密码不匹配，是否<a href="/site/findpassword">忘记密码</a>
                </p>
              <?php endif ?>
              

              <?= Html::submitButton('立即登录', ['class' => 'loginBtn']) ?>

            <?php ActiveForm::end(); ?>

          </div>
        </div>
      </div>
    </div>

<script type="text/javascript">
  $(function(){
    var success = <?php echo $error;?>;
    if(success == 2){
      layer.msg('登录成功，即将为您跳转……', {time: 1800}, function(){
        window.location.href = "/index";
        //window.history.back(-3);
        //window.location.href=document.referrer;
      });
    }
  })
</script>
<style type="text/css">
  .layui-layer-content{padding: 12px 25px;text-align: center;}
  #layui-layer1{width: 240px}
</style>
<?php
$this->registerJsFile('/js/user.js');
$this->registerJsFile('http://static.tianpinwang.com.cn/v1/js/layer/layer.js');
?>
